home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue28 / calcomp / CALCOMP.ZIP / DEMO.ZIP / CALUNIT.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1997-08-31  |  2.2 KB  |  107 lines

  1. unit calunit;
  2.  
  3. interface
  4.  
  5. uses Windows, Classes, Graphics, Forms, Controls, Menus,
  6.   Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, CalComp, shellapi;
  7.  
  8. const
  9.   crHandCur = 8888;
  10.  
  11. type
  12.   TAppForm = class(TForm)
  13.     CalComp1: TCalComp;
  14.     Edit1: TEdit;
  15.     Label1: TLabel;
  16.     Button1: TButton;
  17.     Label2: TLabel;
  18.     Edit2: TEdit;
  19.     Button2: TButton;
  20.     CalComp2: TCalComp;
  21.     Label3: TLabel;
  22.     Label4: TLabel;
  23.     Label5: TLabel;
  24.     Label6: TLabel;
  25.     Label7: TLabel;
  26.     procedure Button1Click(Sender: TObject);
  27.     procedure Button2Click(Sender: TObject);
  28.     procedure FormCreate(Sender: TObject);
  29.     procedure Label3Click(Sender: TObject);
  30.   private
  31.     { Private declarations }
  32.   public
  33.     { Public declarations }
  34.   end;
  35.  
  36. var
  37.   AppForm: TAppForm;
  38.  
  39. implementation
  40.  
  41. uses SysUtils;
  42.  
  43. {$R *.DFM}
  44. {$R CALCURS.RES}
  45.  
  46. procedure TAppForm.Button1Click(Sender: TObject);
  47. var
  48.  s:string[10];
  49. begin
  50.  with calcomp1 do
  51.   begin
  52.    s:=edit1.text;
  53.    month:=strtoint(copy(s,1,pos('-',s)-1));
  54.    delete(s,1,pos('-',s));
  55.    day:=strtoint(copy(s,1,pos('-',s)-1));
  56.    delete(s,1,pos('-',s));
  57.    year:=strtoint(s);
  58.  
  59.    if execute then
  60.      begin
  61.       edit1.text:=inttostr(month)+'-'+inttostr(day)+'-'+inttostr(year);
  62.       label6.caption:=inttostr(calcomp1.week);
  63.     end;
  64.   end;
  65. end;
  66.  
  67. procedure TAppForm.Button2Click(Sender: TObject);
  68. var
  69.  s:string[10];
  70. begin
  71.  with calcomp2 do
  72.   begin
  73.    s:=edit2.text;
  74.    month:=strtoint(copy(s,1,pos('-',s)-1));
  75.    delete(s,1,pos('-',s));
  76.    day:=strtoint(copy(s,1,pos('-',s)-1));
  77.    delete(s,1,pos('-',s));
  78.    year:=strtoint(s);
  79.  
  80.    if execute then
  81.      begin
  82.       edit2.text:=inttostr(month)+'-'+inttostr(day)+'-'+inttostr(year);
  83.       label7.caption:=inttostr(calcomp2.week);      
  84.     end;
  85.   end;
  86. end;
  87.  
  88. procedure TAppForm.FormCreate(Sender: TObject);
  89. var
  90.  da,mo,ye:word;
  91. begin
  92.  decodedate(now,ye,mo,da);
  93.  edit1.text:=inttostr(mo)+'-'+inttostr(da)+'-'+inttostr(ye);
  94.  edit2.text:=edit1.text;
  95.  
  96.  Screen.Cursors[crHandCur] := LoadCursor(HInstance,PChar(8888));
  97.  Label3.cursor:=crHandCur;
  98. end;
  99.  
  100. procedure TAppForm.Label3Click(Sender: TObject);
  101. begin
  102.  ShellExecute(Application.Handle,'open','http://www.ven.be/freestyle/delphi.htm', nil, nil, SW_NORMAL);
  103. end;
  104.  
  105. end.
  106.  
  107.